package com.hzit.controller;

import com.hzit.common.entity.R;
import com.hzit.entity.Goods;
import com.hzit.entity.ItemCat;
import com.hzit.entity.group.GoodsGroup;
import com.hzit.service.IGoodsService;
import com.hzit.service.IItemCatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wf
 * @since 2023-08-07
 */
@RestController
@RequestMapping("/goods")
public class GoodsController {
	@Autowired
	private IGoodsService goodsService;
	@Autowired
	private IItemCatService itemCatService;

	//1. 列表商品
	@GetMapping("/list")
	public R findAll(){
		return R.ok().put("list",goodsService.list());
	}


	//2. 保存spu商品、spu商品描述、sku商品列表
	@PostMapping("/save")
	public R save(@RequestBody GoodsGroup goodsGroup){
		goodsService.save(goodsGroup);
		return R.ok();
	}
}
